package it.uniroma2.art.owlart.model.syntax.manchester;

import it.uniroma2.art.owlart.models.OWLModel;
import it.uniroma2.art.owlart.exceptions.ModelUpdateException;
import it.uniroma2.art.owlart.model.ARTBNode;
import it.uniroma2.art.owlart.model.ARTResource;


public class Primary {
	private boolean not;
	private Atomic a;
	public OWLModel model;
	public ARTResource resource;

	public Primary(boolean n,Restriction res,OWLModel mod) throws ModelUpdateException {
		not=n;
		a=null;
		model=mod;
		this.resource=res.resource;

		ARTBNode bnode=model.createBNode();
		if(not) {

		    	model.addComplementOf(bnode.getID(), res.resource);
			resource=bnode;

		}

	}

	public Primary(boolean n,Atomic ato,OWLModel mod) throws ModelUpdateException {
		not=n;
		a=ato;
		model=mod;
		resource=a.resource;

		ARTBNode bnode=model.createBNode();
		if(not) {

			model.addComplementOf(bnode.getID(), a.resource);
			resource=bnode;

		}

	}

	public boolean isRestriction() {
		if(a==null) return true;
		else return false;
	}

	public boolean not() {
		return not;
	}

}
